//
//  TitleIconButton.m
//  DemoTest
//
//  Created by DaShuEdu on 2017/5/17.
//  Copyright © 2017年 DaShuEdu. All rights reserved.
//

#import "TitleIconButton.h"

@implementation TitleIconButton

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageView.contentMode = UIViewContentModeCenter;
        
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:14];
        self.titleLabel.textColor = [UIColor blackColor];
    }
    return self;
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect {
    CGFloat h = contentRect.size.height;
    return CGRectMake(contentRect.size.width-29, 0, 29, h);
}

- (CGRect)imageRectForContentRect:(CGRect)contentRect {
    CGFloat w = 25;
    CGFloat h = contentRect.size.height;
    return CGRectMake(0, 0, w, h);
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
